using System;
using System.Collections.Generic;
using System.ComponentModel;
using Sinacor.Servico.Bovespa.Calendario.BusinessEntity;
using Sinacor.Servico.Bovespa.Calendario.Service.DataContract.Response;

namespace Sinacor.Servico.Bovespa.Calendario.Service.ServiceImplementation.Translator
{
    public static class TranslateBetweenCalendarioAndCalendarioResponse
    {
        public static Sinacor.Servico.Bovespa.Calendario.BusinessEntity.Calendario 
            TranslateCalendarioResponseToCalendario
            (Sinacor.Servico.Bovespa.Calendario.Service.DataContract.Response.CalendarioResponse from)
        {
            Sinacor.Servico.Bovespa.Calendario.BusinessEntity.Calendario 
                to = new Sinacor.Servico.Bovespa.Calendario.BusinessEntity.Calendario();

            to.DataPregao = from.DataPregao;

            return to;
        }

        public static Sinacor.Servico.Bovespa.Calendario.Service.DataContract.Response.CalendarioResponse 
            TranslateCalendarioToCalendarioResponse
            (Sinacor.Servico.Bovespa.Calendario.BusinessEntity.Calendario from)
        {
            Sinacor.Servico.Bovespa.Calendario.Service.DataContract.Response.CalendarioResponse 
                to = new Sinacor.Servico.Bovespa.Calendario.Service.DataContract.Response.CalendarioResponse();

            to.DataPregao = from.DataPregao;

            return to;
        }

        public static List<DataContract.Response.CalendarioResponse>
        TranslateCalendarioListToCalendarioResponseList
        (List<BusinessEntity.Calendario> from)
        {
            List<DataContract.Response.CalendarioResponse>
                to = new List<DataContract.Response.CalendarioResponse>();

            foreach (BusinessEntity.Calendario fromItem in from)
            {
                to.Add(Translator
                    .TranslateBetweenCalendarioAndCalendarioResponse
                    .TranslateCalendarioToCalendarioResponse(fromItem));
            }
            return to;
        }
    }
}

